4 require_once __DIR__
. '/../../_inc.php';
6 if ($user['droits']['membres'] < Membres
::DROIT_ECRITURE
)
8 throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
13 $cotisations = new Cotisations
;
14 $m_cotisations = new Cotisations_Membres
;
16 if (empty($_GET['id']) ||
!is_numeric($_GET['id']))
18 throw new UserException("Argument du numéro de cotisation membre manquant.");
21 $id = (int) $_GET['id'];
23 $co = $m_cotisations->get($id);
27 throw new UserException("Cette cotisation membre n'existe pas.");
30 $membre = $membres->get($co['id_membre']);
34 throw new UserException("Le membre lié à la cotisation n'existe pas ou plus.");
39 if (!empty($_POST['delete']))
41 if (!utils
::CSRF_check('del_cotisation_' . $co['id']))
43 $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
48 $m_cotisations->delete($co['id']);
49 utils
::redirect('/admin/membres/cotisations.php?id=' . $membre['id']);
51 catch (UserException
$e)
53 $error = $e->getMessage();
58 $tpl->assign('error', $error);
59 $tpl->assign('membre', $membre);
60 $tpl->assign('cotisation', $co);
62 $tpl->display('admin/membres/cotisations/supprimer.tpl');